package reporting;

import java.sql.Timestamp;

import junit.framework.Assert;

public class Report
{

	public static void error(String text)
	{
		text = "ERROR:\t" + text;
		Write(getTimestamp() + "\t" + text);
		Assert.fail();
	}
	
	public static void error(String text, Exception ex)
	{
		text = "ERROR:\t" + text;
		Write(getTimestamp() + "\t" + text + ". The following exception is thrown:");
		Write(ex.getMessage());
		Assert.fail();
	}

	public static void pass(String text)
	{
		text = "PASS:\t" + text;
		Write(getTimestamp() + "\t" + text);
	}

	public static void info(String text)
	{
		text = "I:\t" + text;
		Write(getTimestamp() + "\t" + text);
	}

	static private String getTimestamp()
	{
		java.util.Date date = new java.util.Date();
		Timestamp timestamp = new Timestamp(date.getTime());
		return timestamp.toString();
	}

	static private void Write(String text)
	{
		System.out.println(text);
	}
}
